<?php
/**
 * Created by PhpStorm.
 * User: zw215
 * Date: 2019/3/23
 * Time: 10:36
 */

namespace App\Http\Controllers\Api;


use App\Validator\LoginValidator;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;


class IndexController extends BaseController
{
    public function __construct()
    {
    }


    public function index(Request $request, $code)
    {
        print_r($code);
        (new LoginValidator())->checkData($request->all(), 'login');
        exit("成功");
    }

    public function testEmail()
    {
        $title = '测试邮件001';
        $content = '测试邮件001';//内容
        Mail::raw('Hello I,mZW,邮件测试成功', function ($message) use ($title) {
            $to = 'm13657313621@163.com';
            $message->subject($title);
            $message->to($to);
            $attachment = 'http://a.hiphotos.baidu.com/image/pic/item/30adcbef76094b3624c1f1e8adcc7cd98d109d60.jpg';
            $message->attach($attachment, ['as' => '测试图片.jpg']);
        });
        var_dump(Mail::failures());
    }
}